package acm.蓝桥杯15;

import java.util.Scanner;

public class 幸运数 {

    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n = sc.nextInt();
        while (n-- > 0) {
            int m = sc.nextInt();
            int[] nums = new int[m];
            int k = sc.nextInt();
            for (int i = 0; i < nums.length; i++) {
                nums[i] = sc.nextInt();
            }
            System.out.println(isLucky(k,nums)?"Yes":"No");
        }
    }
    public static boolean isLucky(int n,int[] nums){
        for (int num : nums) {
            if ((num+n)%7==0){
                return true;
            }
        }
        return false;
    }
}
